package com.aaronprj.common.enums.mbooks;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.aaronprj.common.enums.IEnumValueName;

public enum ItemCategory implements IEnumValueName{
	TextBook(1,"Text Book", 3),
	Others(2,"Others", 4);
	
	private int value;
	private String displayName;
	private int rate;
	
	
	ItemCategory(int value, String displayName, int rate){
		this.value = value;
		this.displayName = displayName;
		this.rate = rate;
		
	}
	
	public int getValue() {
		return value;
	}

	public String getDisplayName() {
		return displayName;
	}
	
	public int getRate() {
		return rate;
	}

	public static List<Map<String, Object>> getEntities() {
		List<Map<String, Object>> enums = new ArrayList<Map<String, Object>>();
		for (ItemCategory e : ItemCategory.values()) {
			if (e instanceof ItemCategory) {
				Map<String, Object> map = new HashMap<String, Object>();
				map.put("name", e);
				map.put("displayName", e.getDisplayName());
				map.put("value", e.getValue());
				map.put("courses", Course.getEntitiesByCategory(e));
				enums.add(map);
			}
		}
		return enums;
	}
	

	public static List<ItemCategory> getEntityList() {
		List<ItemCategory> enumes = new ArrayList<ItemCategory>();
		for (ItemCategory e : ItemCategory.values()) {
			if (e instanceof ItemCategory) {
				enumes.add(e);
			}
		}
		return enumes;
	}
	

}
